﻿using System;
using System.Collections.Generic;

namespace Simp.CodeModel
{
	/// <summary>Function taking no parameters as input.</summary>
	public abstract class ParameterLessFunctionBase : IFunction
	{
		#region IFunction Members
		/// <summary>See <see cref="IFunction.FunctionName"/>.  Implemented in derived classes.</summary>
		public abstract string FunctionName { get; }

		/// <summary>Returns an empty list since there are no parameters.</summary>
		public string[] ParameterNames
		{
			get { return FunctionHelper.EmptyParameterNames; }
		}

		/// <summary>Returns an empty list since there are no parameters.</summary>
		public IFunctionParameterBinding[] DefaultParameterValues
		{
			get { return FunctionHelper.EmptyBindings; }
		}

		/// <summary>See <see cref="IFunction.Simplify"/>.  Implemented in derived classes.</summary>
		/// <param name="simplificationMode"/>
		/// <param name="parameters"></param>
		/// <returns></returns>
		public IFunction Simplify(SimplificationMode simplificationMode, params IFunction[] parameters)
		{
			FunctionHelper.ValidateParameters(this, parameters);

			return Simplify(simplificationMode);
		}

		/// <summary>See <see cref="IFunction.AcceptVisitor"/>.  Implemented in derived classes.</summary>
		/// <param name="visitor"></param>
		/// <returns></returns>
		public abstract IFunction AcceptVisitor(IFunctionVisitor visitor);
		#endregion

		/// <summary>See <see cref="IFunction.Simplify"/>.  Implemented in derived classes.</summary>
		/// <param name="simplificationMode"/>
		/// <returns></returns>
		protected abstract IFunction Simplify(SimplificationMode simplificationMode);
	}
}